package com.ryhx.wifi;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

/**  
 * All rights Reserved, Designed By yaojinshan
 * @Title:  OracleTest.java   
 * @Package com.ryhx.wifi   
 * @author: yaojinshan     
 * @date:   2018年7月26日 下午5:13:11   
 * @version V1.0 
 * @Copyright: 2018 All users All rights reserved. 
 * 注意：注意：本内容仅限于学习springmvc + spring + maven + mybatis学习使用 
 */
public class OracleTest {

	/** 
	 * @param args
	 * @return  返回值类型: <pre>  
	 * @author 作者: yaojinshan <pre>
	 * @throws Exception 
	 * @date 2018年7月26日 下午5:13:11 <pre> 
	 * @throws 异常: <pre>
	 */
	public static void main(String[] args) throws Exception {
		Class.forName("net.sf.log4jdbc.DriverSpy");
		String url = "jdbc:log4jdbc:oracle:thin:@10.10.10.10:1521:ryhx";
		String username = "tposuser";
		String password = "tposuser";
		System.out.println("获取数据库连接开始-----------------》》》》" + url);
		Connection connection = DriverManager.getConnection(url, username, password);
		System.out.println("获取数据库连接结束-----------------》》》》 " + connection);
		//Connection connection = ConnectionUtil.getConnection();
		PreparedStatement prepareStatement = connection.prepareStatement("select store_no,TERMINAL_NO,order_time from POS_ORDER where TERMINAL_NO = '55046491'");
		ResultSet executeQuery = prepareStatement.executeQuery();
		while (executeQuery.next()) {
//			System.out.println(executeQuery.getString("TERMINAL_NO") + ":" + executeQuery.getString("STORE_NO"));
			System.out.println(executeQuery.getString(1) + ":" + executeQuery.getString(2) + ":" + executeQuery.getString(3) );
		}
	}
}
